﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using TpBaseObjects.Models.BusinessCases;
using TpBaseObjects.Objects;
using TpOffice.Controller;

namespace TpOffice.Forms.BusinessCase {

    public partial class BusinessCasesShortListForm : Form {

        #region Members

        BusinessCasesShortListController controller;
        
        #endregion

        #region Constructor

        public BusinessCasesShortListForm() {
            InitializeComponent();
            //this.dataGridView1.Columns[0].Visible = false;
            this.controller = new BusinessCasesShortListController(this);
            this.controller.LoadModels();
            SetFormDataSources();
            SetFormEventHandler();
            
        }

        #endregion

        #region Properties

        public List<BusinessCasesShortListModel> MyModel {
            get;
            set;
        }

        public BusinessCasesSelectModel MySelectModel {
            get;
            set;
        }

        public List<BusinessCaseStatusObj> MyBusinessCaseStatusModel {
            get;
            set;
        }

        public List<CustomerSourceObj> MyCustomerSourceModel {
            get;
            set;
        }

        public List<OrganisationsShortListObj> MyPurchaserModel {
            get;
            set;
        }

        public List<PlzOrt> MyPlzOrtModel {
            get;
            set;
        }

        public List<TecUserObj> MyFileUserModel {
            get;
            set;
        }

        public List<CustomerGroupObj> MyCustomerGroupModel {
            get;
            set;
        }

        #endregion

        #region Methods

        public void SetFormDataSources() {
            this.bsBusinessCasesShortList.DataSource = this.MyModel;
            this.bsSelectModel.DataSource = this.MySelectModel;
            this.bsBusinessCaseStatus.DataSource = this.MyBusinessCaseStatusModel;
            this.bsCustomerSource.DataSource = this.MyCustomerSourceModel;
            this.bsPurchaser.DataSource = this.MyPurchaserModel;
            this.bsPlzOrt.DataSource = this.MyPlzOrtModel;
            this.bsFileUser.DataSource = this.MyFileUserModel;
            this.bsCustomerGroup.DataSource = this.MyCustomerGroupModel;
        }

        private void SetFormEventHandler() {
            this.dataGridView1.RowHeaderMouseDoubleClick += new DataGridViewCellMouseEventHandler(this.controller.OpenBusinessCase);
            this.btnNewBusinesCase.Click += new EventHandler(this.controller.CreateNewBusinessCase);
        }

        #endregion


    }
}
